package com.jinhua.huaojbackendjudgeservice.judge.codesandbox.impl;


import com.jinhua.huaojbackendjudgeservice.judge.codesandbox.CodeSandBox;
import com.jinhua.huaojbackendmodel.model.codesandbox.ExecuteCodeRequest;
import com.jinhua.huaojbackendmodel.model.codesandbox.ExecuteCodeResponse;
import com.jinhua.huaojbackendmodel.model.codesandbox.JudgeInfo;
import com.jinhua.huaojbackendmodel.model.enums.QuestionSubmitJudgeInfoMessageEnum;
import com.jinhua.huaojbackendmodel.model.enums.QuestionSubmitStateEnum;

import java.util.List;

/**
 * 示例代码沙箱（仅为了跑通流程）
 */
public class ExampleCodeSandBox implements CodeSandBox {
    @Override
    public ExecuteCodeResponse excuteCode(ExecuteCodeRequest executeCodeRequest) {
        String code = executeCodeRequest.getCode();
        String language = executeCodeRequest.getLanguage();
        List<String> inputList = executeCodeRequest.getInputList();

        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();

        executeCodeResponse.setOutputList(inputList);

        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(QuestionSubmitJudgeInfoMessageEnum.ACCEPTED.getValue());
        judgeInfo.setTime(100l);
        judgeInfo.setMemory(100l);

        executeCodeResponse.setExcuteInfo(judgeInfo);
        executeCodeResponse.setState(QuestionSubmitStateEnum.ACCOMPLISH.getValue());
        System.out.println("示例代码沙箱");
        return executeCodeResponse;
    }
}
